/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_master_item")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosMasterItem.findAll", query = "SELECT p FROM PosMasterItem p"),
//    @NamedQuery(name = "PosMasterItem.findBySync", query = "SELECT p FROM PosMasterItem p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosMasterItem.findByItemId", query = "SELECT p FROM PosMasterItem p WHERE p.itemId = :itemId"),
//    @NamedQuery(name = "PosMasterItem.findByItemCode", query = "SELECT p FROM PosMasterItem p WHERE p.itemCode = :itemCode"),
//    @NamedQuery(name = "PosMasterItem.findByItemName", query = "SELECT p FROM PosMasterItem p WHERE p.itemName = :itemName"),
//    @NamedQuery(name = "PosMasterItem.findByItemPrice", query = "SELECT p FROM PosMasterItem p WHERE p.itemPrice = :itemPrice")})
public class PosMasterItem implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "item_id")
    private Integer itemId;
    @Column(name = "item_code")
    private String itemCode;
    @Column(name = "item_name")
    private String itemName;
    @Column(name = "item_minimum")
    private BigDecimal itemMinimum;
    @Column(name = "item_price_buy")
    private BigDecimal itemPriceBuy;
    @Column(name = "item_price_sell")
    private BigDecimal itemPriceSell;
    @Column(name = "item_price_outlet")
    private BigDecimal itemPriceOutlet;
    @Column(name = "item_price_main_kitchen")
    private BigDecimal itemPriceMainKitchen;
    @Lob
    @Column(name = "item_description")
    private String itemDescription;
    @JoinColumn(name = "item_satuan_id", referencedColumnName = "satuan_id")
    @ManyToOne(optional = false)
    private PosMasterSatuan itemSatuanId;
    @JoinColumn(name = "item_satuan_order_id", referencedColumnName = "satuan_id")
    @ManyToOne(optional = false)
    private PosMasterSatuan itemSatuanOrderId;
    @JoinColumn(name = "item_type_id", referencedColumnName = "type_id")
    @ManyToOne(optional = false)
    private PosMasterType itemTypeId;
    @JoinColumn(name = "item_rasa_id", referencedColumnName = "rasa_id")
    @ManyToOne(optional = false)
    private PosMasterRasa itemRasaId;

    public PosMasterItem() {
    }

    public PosMasterItem(Integer itemId) {
        this.itemId = itemId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getItemId() {
        return itemId;
    }

    public void setItemId(Integer itemId) {
        this.itemId = itemId;
    }

    public PosMasterSatuan getItemSatuanOrderId() {
        return itemSatuanOrderId;
    }

    public void setItemSatuanOrderId(PosMasterSatuan itemSatuanOrderId) {
        this.itemSatuanOrderId = itemSatuanOrderId;
    }

    public String getItemCode() {
        return itemCode;
    }

    public void setItemCode(String itemCode) {
        this.itemCode = itemCode;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public BigDecimal getItemPriceBuy() {
        return itemPriceBuy;
    }

    public void setItemPriceBuy(BigDecimal itemPriceBuy) {
        this.itemPriceBuy = itemPriceBuy;
    }

    public BigDecimal getItemPriceSell() {
        return itemPriceSell;
    }

    public void setItemPriceSell(BigDecimal itemPriceSell) {
        this.itemPriceSell = itemPriceSell;
    }

    public BigDecimal getItemPriceOutlet() {
        return itemPriceOutlet;
    }

    public void setItemPriceOutlet(BigDecimal itemPriceOutlet) {
        this.itemPriceOutlet = itemPriceOutlet;
    }

    public BigDecimal getItemPriceMainKitchen() {
        return itemPriceMainKitchen;
    }

    public void setItemPriceMainKitchen(BigDecimal itemPriceMainKitchen) {
        this.itemPriceMainKitchen = itemPriceMainKitchen;
    }

    public String getItemDescription() {
        return itemDescription;
    }

    public void setItemDescription(String itemDescription) {
        this.itemDescription = itemDescription;
    }

    public PosMasterSatuan getItemSatuanId() {
        return itemSatuanId;
    }

    public void setItemSatuanId(PosMasterSatuan itemSatuanId) {
        this.itemSatuanId = itemSatuanId;
    }

    public PosMasterType getItemTypeId() {
        return itemTypeId;
    }

    public void setItemTypeId(PosMasterType itemTypeId) {
        this.itemTypeId = itemTypeId;
    }

    public PosMasterRasa getItemRasaId() {
        return itemRasaId;
    }

    public void setItemRasaId(PosMasterRasa itemRasaId) {
        this.itemRasaId = itemRasaId;
    }

    public BigDecimal getItemMinimum() {
        return itemMinimum;
    }

    public void setItemMinimum(BigDecimal itemMinimum) {
        this.itemMinimum = itemMinimum;
    }

    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemId != null ? itemId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosMasterItem)) {
            return false;
        }
        PosMasterItem other = (PosMasterItem) object;
        if ((this.itemId == null && other.itemId != null) || (this.itemId != null && !this.itemId.equals(other.itemId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return itemName;
//        return "com.buanalintas.ronsicecream.pos.entities.PosMasterItem[ itemId=" + itemId + " ]";
    }
}
